﻿<?php
/*
 * 更多活动检索
 */
require_once '../init.php';
define('TEMPLATE_PATH', WANYA_ROOT . '/m/view/');

/*$appid = "wxbee55928ce2bfa25";
$secret = "1370b77e269a256ede75d700c8054ce6";

$code = $_GET["code"];

// 得到token
$get_token_url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$appid.'&secret='.$secret.'&code='.$code.'&grant_type=authorization_code';
$res=file_get_contents($get_token_url);

$token_obj = json_decode($res,true);
$openid = $token_obj['openid'];
$access_token = $token_obj['access_token'];*/

// TODO 通过openid，去检索用户

$User_Info_Model = new User_Info_Model();

$openid = "12345678";
/*echo($openid);*/
$userSimpleInfos = array_filter($User_Info_Model->getViewUserInfo($openid));
/*var_dump($userSimpleInfos);*/
// 用户不存在跳转到注册 存在继续判断用户该在哪一个页面
if (empty($userSimpleInfos)) {
    // 得到用户信息
    /*  $get_info_url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token='+$access_token+'&openid='+$openid+'&lang=zh_CN';
   $res=file_get_contents($get_token_url);
   $info_obj = json_decode($res,true);*/

    $info_obj =  array();
    $info_obj['headimgurl']='http://wx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/0';
    $info_obj['nickname']="btbear";
    $info_obj['sex']="1";
    $site_title = "成为会员";
   // TODO　获得用户基本信息后，调转注册页面
    include View::getView('user/userReg');
    View::output();
}
$Activity_Model = new Activity_Model();
    $OldActivityResult = array_filter($Activity_Model->selectOldActivity());
    if(empty($OldActivityResult)){
        //为空
        $isNull = 1;
    }else{
        $isNull = 0;
    }
    $site_title = "更多活动";
    //开始跳转
    include View::getView('activity/moreActivity');
    View::output();

?>






